/**
 * 
 */
package ca.uwindsor.cs.deepweb.estimation.experiment.wikipedia.chinese;

import java.io.IOException;

import ca.uwindsor.cs.deepweb.estimation.experiment.QueryRunner;

/**
 * @author Liang Jie
 *
 */
public class ZHCharacterQueryRunner extends QueryRunner {

	/**
	 * Run a query
	 * 
	 * @param indexdir
	 *            The dictionary to restore Lucene index file
	 * @param dictfile
	 *            The dictionary file
	 * @param length
	 *            The length of the character needed
	 * @param result
	 *            The dictionary to restore query result
	 * @throws IOException 
	 */
	public ZHCharacterQueryRunner(String indexdir, int corpussize, String dictfile, String length,
			String result) throws IOException{
		super( indexdir, corpussize, null, dictfile,  length, result);
		super.selector = new RandomWordChooser(dictFile, "UTF-8");
	}
	
	protected boolean isStepSmallerThenSize(){
		return true;
	}
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
//		args = new String[5];
//		args[0] = "Experiment\\zh_wiki";
//		args[1] = "Dictionary\\ChineseWords.txt";
//		args[2] = "0";
//		args[3] = "Result";
//		args[4] = "10";

		if (args.length != 6) {
			System.out
					.println("usage: java -jar ZHCharacterQueryRunner.jar LuceneIndexDirectory DictionaryFile minWordLength[ignored] ResultDirectory StepNumber");
		} else {
			ZHCharacterQueryRunner query;
			try {
				query = new ZHCharacterQueryRunner(args[0], Integer.parseInt(args[1]),args[2], args[3],
						args[4]);

				int step = Integer.parseInt(args[6]);
				query.goQuery(step);
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			
		}
	}

}
